package com.lx.spring.jdbc.Action;

import com.lx.spring.jdbc.biz.BankBiz;
import com.lx.spring.mvc.entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
public class AccountAction {

    @Autowired
    BankBiz biz;

    @RequestMapping("transfer")
    public Result transfer(HttpServletRequest req){
        long id2 = Long.valueOf(req.getParameter("id2"));
        long id1 = Long.valueOf(req.getParameter("id1"));
        double money = Double.parseDouble(req.getParameter("money"));
        Result ret = biz.transfer(id1, id2, money);
        return ret;

    }
}
